//
//  HEGhostButtonView.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/25.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEGhostButtonView.h"

@interface HEGhostButtonView ()

@property (nonatomic, strong) QMUIFillButton *consulBtn;

@end

@implementation HEGhostButtonView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = KWhiteColor;
        [self initUI];
    }
    return self;
}

- (void)initUI {
    // 登录按钮
    
    QMUIFillButton *consulBtn = [[QMUIFillButton alloc] initWithFillType:QMUIFillButtonColorBlue];
    _consulBtn = consulBtn;
    consulBtn.titleLabel.font = DYBlodFont(15);
    [consulBtn setBackgroundColor:CNavBgColor];
    [consulBtn setTitle:@"直接预约上门" forState:UIControlStateNormal];
    [self addSubview:consulBtn];
    [consulBtn addTarget:self action:@selector(consulBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    [consulBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).mas_offset(10);
        make.left.equalTo(self).mas_offset(40);
        make.right.equalTo(self).mas_offset(-40);
//        make.height.mas_offset(40);
        make.bottom.equalTo(self).mas_offset(-10);
    }];
}

- (void)setupTitle:(NSString *)title {
    [_consulBtn setTitle:title forState:UIControlStateNormal];
}

- (void)consulBtnClick {
    if (self.tapBlock) {
        self.tapBlock();
    }
}

- (void)tapBlock:(ghostButtomTapBlock)block {
    self.tapBlock = block;
}

@end
